home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / pctchnqs / 1992 / number1 / prfile.h < prev    next >
C/C++ Source or Header  |  1992-01-05  |  1KB  |  64 lines

  1. #include <fstream.h>
  2.  
  3. #define Uses_TNSCollection
  4. #define Uses_TObject
  5. #include <tv.h>
  6.  
  7. class TPrintFile : public TObject
  8.   {
  9.   const char *_name;
  10.  
  11.   public:
  12.  
  13.   TPrintFile(const char *name);
  14.  
  15.   virtual ~TPrintFile();
  16.  
  17.   const char *name()
  18.   {
  19.   return (_name);
  20.   }
  21.   };
  22.  
  23. class TPrintQueue : public TNSCollection
  24.   {
  25.   enum
  26.     {
  27.     timeOut     = 0x01,
  28.     ioError     = 0x08,
  29.     selected    = 0x10,
  30.     outOfPaper  = 0x20,
  31.     acknowledge = 0x40,
  32.     notBusy     = 0x80
  33.     };
  34.  
  35.   enum
  36.     {
  37.     printChar, initPrinter, readStatus
  38.     };
  39.  
  40.   int _port;        // Printer port number.
  41.   ifstream f;        // Printer input file.
  42.   char buffer[1024];    // Printer buffer.
  43.   char *bufend;        // End of buffer.
  44.   const char *bufptr;    // Current index into buffer.
  45.   Boolean dialogOpen;    // True if error dialog box is open.
  46.  
  47.   public:
  48.  
  49.   static TPrintQueue printQueue;
  50.  
  51.   // Should be private.
  52.   TPrintQueue(int port);
  53.  
  54.   void removeFile();
  55.  
  56.   void removeAll();
  57.  
  58.   Boolean cancel();
  59.  
  60.   void print();
  61.   };
  62.  
  63. const int cmPrintFile   = 100;
  64.